﻿/// <reference path="jquery-1.9.1.js"/>
/// <reference path="jquery.zclip.js"/>

$(function () {

    $("#DD").zclip({
        path: 'ZeroClipboard.swf',
        copy: function () {
            return "1";
        }
    });

    var icons = {
        header: "ui-icon-circle-arrow-e",
        activeHeader: "ui-icon-circle-arrow-s"
    };

    $("#accordion").accordion({
        icons: icons
    });

    //设置全局Ajax请求选项
    $.ajaxSetup({
        global: false,
        cache: false
    });


    $.get("../Config/mapping.xml", function (result) {

        //load主菜单
        $(result).find("SubMenu").each(function () {
            var id = $(this).attr("id")
            var url = $(this).attr("url");

            $("#" + id).bind('click', function () {
                $("#divContent").load(url, function () {

                    //点击查看源码按钮事件
                    $(".showbox-button").on("click", function () {
                        $obj = $(this);
                        $code = $obj.parent().find(".showbox-code");
                        $content = $obj.parent().find(".showbox-content");

                        $content.text($code.html()).toggle("normal");
                    });

                    $('#bb').on('click', function () {
                        $(this).zclip({
                            path: 'ZeroClipboard.swf',
                            copy: function () {
                                return "1";
                            }
                        });
                    });
                });
            });
        });

    }, 'xml');
});